using System;
using System.Collections.Generic;
using System.Linq;
using game_config;
using Newtonsoft.Json;

namespace rogue_game
{
    [Serializable]
    public class RogueFixData
    {
        public string Name { get; set; }
        public int[]? Weapons { get; set; }
        public Dictionary<int, int>? PassiveToLv { get; set; }
        public int Prop { get; set; }

        [JsonConstructor]
        public RogueFixData(string name, int[]? weapons, Dictionary<int, int>? passiveToLv, int prop)
        {
            Name = name;
            Weapons = weapons;
            PassiveToLv = passiveToLv;
            Prop = prop;
        }
    }

    [Serializable]
    public readonly struct RogueGameSetting
    {
        public int CreepExtraPassiveNum { get; }

        public int BossExtraPassiveNum { get; }

        public int EnemyWeaponLv { get; }

        public float ShopMoreCoinMulti { get; }

        public float ShopLackMulti { get; }

        public passive_id[] MaskPassiveIds { get; }

        public int Depth { get; }

        public Dictionary<int, RogueFixData> ChapterToFixDataS { get; }

        public bool OnChallenge { get; }

        public RogueGameSetting(int creepExtraPassiveNum, int bossExtraPassiveNum, float shopMoreCoinMulti,
            float shopLackMulti, int enemyWeaponLv, passive_id[] maskPassiveIds, int depth,
            Dictionary<int, RogueFixData> chapterToFixDataS, bool onChallenge)
        {
            CreepExtraPassiveNum = creepExtraPassiveNum;
            BossExtraPassiveNum = bossExtraPassiveNum;
            ShopMoreCoinMulti = shopMoreCoinMulti;
            ShopLackMulti = shopLackMulti;
            EnemyWeaponLv = enemyWeaponLv;
            MaskPassiveIds = maskPassiveIds;
            Depth = depth;
            OnChallenge = onChallenge;
            ChapterToFixDataS = chapterToFixDataS.ToDictionary(pair => pair.Key, pair => pair.Value);
        }

        public static RogueGameSetting Zero()
        {
            return new RogueGameSetting(0, 0, 0, 0, 0, new passive_id[] { }, 0, new Dictionary<int, RogueFixData>(), false);
        }
    }
}